<?php
use App\Models\HomeVisitSubject;

if (!function_exists('get_national_option')) {
    function get_national_option()
    {
        return [
            '1001'=>'汉族',
            '1002'=>'满族',
            '1003'=>'蒙古族',
            '1004'=>'回族',
            '1005'=>'藏族',
            '1006'=>'维吾尔族',
            '1007'=>'苗族',
            '1008'=>'彝族',
            '1009'=>'壮族',
            '1010'=>'布依族',
            '1011'=>'基诺族',
            '1012'=>'侗族',
            '1013'=>'瑶族',
            '1014'=>'白族',
            '1015'=>'土家族',
            '1016'=>'哈尼族',
            '1017'=>'哈萨克族',
            '1018'=>'傣族',
            '1019'=>'黎族',
            '1020'=>'傈僳族',
            '1021'=>'佤族',
            '1022'=>'畲族',
            '1023'=>'高山族',
            '1024'=>'拉祜族',
            '1025'=>'水族',
            '1026'=>'东乡族',
            '1027'=>'纳西族',
            '1028'=>'景颇族',
            '1029'=>'柯尔克孜族',
            '1030'=>'土族',
            '1031'=>'达斡尔族',
            '1032'=>'仫佬族',
            '1033'=>'羌族',
            '1034'=>'布朗族',
            '1035'=>'撒拉族',
            '1036'=>'毛南族',
            '1037'=>'仡佬族',
            '1038'=>'锡伯族',
            '1039'=>'阿昌族',
            '1040'=>'普米族',
            '1041'=>'朝鲜族',
            '1042'=>'塔吉克族',
            '1043'=>'怒族',
            '1044'=>'乌孜别克族',
            '1045'=>'俄罗斯族',
            '1046'=>'鄂温克族',
            '1047'=>'德昂族',
            '1048'=>'保安族',
            '1049'=>'裕固族',
            '1050'=>'京族',
            '1051'=>'塔塔尔族',
            '1052'=>'独龙族',
            '1053'=>'鄂伦春族',
            '1054'=>'赫哲族',
            '1055'=>'门巴族',
            '1056'=>'珞巴族'
        ];
    }
}

if (!function_exists('is_serialized')) {
    function is_serialized($value, &$result = null)
    {
        // Bit of a give away this one
        if (!is_string($value)) {
            return false;
        }
        // Serialized false, return true. unserialize() returns false on an
        // invalid string or it could return false if the string is serialized
        // false, eliminate that possibility.
        if ($value === 'b:0;') {
            $result = false;
            return true;
        }
        $length = strlen($value);
        $end = '';
        switch ($value[0]) {
            case 's':
                if ($value[$length - 2] !== '"') {
                    return false;
                }
            case 'b':
            case 'i':
            case 'd':
                // This looks odd but it is quicker than isset()ing
                $end .= ';';
            case 'a':
            case 'O':
                $end .= '}';
                if ($value[1] !== ':') {
                    return false;
                }
                switch ($value[2]) {
                    case 0:
                    case 1:
                    case 2:
                    case 3:
                    case 4:
                    case 5:
                    case 6:
                    case 7:
                    case 8:
                    case 9:
                        break;
                    default:
                        return false;
                }
            case 'N':
                $end .= ';';
                if ($value[$length - 1] !== $end[0]) {
                    return false;
                }
                break;
            default:
                return false;
        }
        if (($result = @unserialize($value)) === false) {
            $result = null;
            return false;
        }
        return true;
    }
}




